<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>FIRST LEGO League na Slovensku - FLL na Slovensku</title>
<base href="http://www.fll.sk/" /> <!--  http://www.davinci.fmph.uniba.sk/~sedlacek27/tis2/ -->
<link href="http://kempelen.ii.fmph.uniba.sk/letnaliga/styles.css" rel="stylesheet" type="text/css" />
</head>
<body>
	<?php  $riesenie = $riesenie[0]; ?> 
	<div id = 'hlava_zadania'>
	<h2>Riešenie týmu: 
	
		<?php 
	 
			$q = $this->db->where('id', $riesenie->uid)
						  ->get('users');
			$usr = $q->result();
			echo $usr[0]->name;
			
			echo '</br>';
			
			$q2 = $this->db->where('sid', $riesenie->id)
						   ->get('img');
			$obrazok = $q2->result();
			
								
			?>
			

	</h2>
	<?php 

	 if ($riesenie->win == 1) {
		?>
		<h2> výherná úloha </h2>
		<?php
	}
	
	?>

	<?php echo $riesenie->content; ?>
	
	<?php if(!empty($obrazok[0]->link)){
		foreach($obrazok as $img) {
		?>
		<p>
			<?php list($width, $height) = getimagesize('http://kempelen.ii.fmph.uniba.sk/letnaliga/images/'.$img->link);
				if($width > 528) {
			?>
			<a target="_blank" href="http://kempelen.ii.fmph.uniba.sk/letnaliga/images/<?php echo $img->link; ?>"><image src="http://kempelen.ii.fmph.uniba.sk/letnaliga/images/<?php echo $img->link; ?>" alt = "solution" style="width: 100%;"/></a>
			<?php } else { ?>
			<a target="_blank" href="http://kempelen.ii.fmph.uniba.sk/letnaliga/images/<?php echo $img->link; ?>"><image src="http://kempelen.ii.fmph.uniba.sk/letnaliga/images/<?php echo $img->link; ?>" alt = "solution"/></a>
			<?php }?>
		</p>
		<?php
		} 
	}?>
		<p> 
			<?php if(!empty($links[0]->link)) {
                foreach($links as $link){
            ?>
                <iframe height="350" src="<?php echo $link->link; ?>" frameborder="0" allowfullscreen style="width: 100%;"></iframe>
			<?php }} ?>
		</p>
		<?php
	
	echo '<p>Prílohy:</p><ul>';
	foreach($attachments as $attachment){

		echo '<li><a href="http://kempelen.ii.fmph.uniba.sk/letnaliga/attachments2/'.$attachment->link.'"/>'.$attachment->link.'</a></li>';
	}
	
	echo '</ul>';
	$q = $this->db->where('id', $riesenie->mid)
						  ->get('missions');
			$misia = $q->result();
			$zverejnena = $misia[0]->resulted;
			
	if ($zverejnena == 1) {		
	?>
	<div id = 'komentare'>
	
		<p> Komentár k úlohe: <?php echo $komentare; ?> </p>
	
	</div>
	<?php
	}
	else {
		echo 'hodnotenie ešte nie je zverejnené.';
	}
	?>
	
	</div>
	
	<div id = 'hodnotenie'>
	<?php
	
	if (($this->session->userdata('logged_in'))){
		if (($this->session->userdata['type'])) {
			$sol_id = $riesenie->id;
			if($pocet_hodnoteni == 0) {
			
				echo form_open("projekt/evalu/{$sol_id}");
				$data = array(
					'name'  => 'komentar',
					'value' => $komentare,
					'rows'  => '5',
					
					
				);
				
				echo form_textarea($data);	
				
				
				$options = array(
							'0'  => '0',
							'1'  => '1',
							'2'  => '2',
							'3'  => '3',                
				);
				echo form_label('Počet bodov', 'hodnotenie');	
				
				echo form_dropdown('hodnotenie', $options, '3');
				
				echo form_submit('submit', 'Vlož hodnotenie');
				
				echo form_close();
			
			}

			echo form_open("projekt/publ/{$riesenie->mid}");
			echo form_input('publish',set_value('publish',''));
			echo form_label('heslo na zverejnenie', 'publish');	
			echo form_submit('submit', 'Zverejni');
			echo form_close();
			
			if ($riesenie->win != 1) {	
				echo form_open("projekt/win/{$sol_id}");
				echo form_submit('submit', 'Označ tento tím ako víťazný');
				echo form_close();
				}
			else {
				echo form_open("projekt/lose/{$sol_id}");
				echo form_submit('submit', 'vymaž víťazstvo tímu');
				echo form_close();			
			}
		}	
	}	
		
		
	?>
	</div>
	
	<a href="<?php echo site_url('projekt/logged'); ?>"> Späť na zadania </a>
	
	<div id = 'logout_butt'>
	<a href="<?php echo site_url('auth/logout'); ?>"> Logout </a>
	</div>
</body>
</html>